﻿using System.Collections.ObjectModel;
using System.Windows.Controls;

using Game.Toolkit;
using Game.Types;

namespace Game.Editor.Toolbox
{
    public partial class VehicleControl2 : UserControl
    {
        readonly WrapPanel _WrapPanel = new WrapPanel();

        public VehicleControl2()
        {
            InitializeComponent();
            Init();
        }

        void InitializeComponent()
        {
            Grid grid = new Grid();
            this.Content = grid;

            ScrollViewer viewer = new ScrollViewer();
            grid.Children.Add(viewer);

            Grid.SetColumn(_WrapPanel, 0);
            Grid.SetRow(_WrapPanel, 0);
            grid.Children.Add(_WrapPanel);
        }

        void Init()
        {
            Collection<VehicleType> col = StandardToolkit.Vehicles;
            foreach (VehicleType v in col)
            {
                VehicleItemControl2 control = new VehicleItemControl2();
                control.MapItemType = v;
                control.Width = 50;
                control.Height = 50;
                _WrapPanel.Children.Add(control);
            }
        }
    }
}
